{% set pypi_name = 'os-apply-config' %}
{% set upstream_version = upstream_version('12.0.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name('os-apply-config', py_versions='py3') }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        OpenStack os-apply-config Configuration Library
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/{{ pypi_name }}
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('fixtures') }}
BuildRequires:  {{ py3('mock') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('pystache') }}
BuildRequires:  {{ py3('python-subunit') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('testscenarios') }}
BuildRequires:  {{ py3('testtools') }}
Requires:       {{ py3('PyYAML') }}
Requires:       {{ py3('anyjson') }}
Requires:       {{ py3('pbr') }}
Requires:       {{ py3('pystache') }}
Requires:       {{ py3('setuptools') }}
Requires:       {{ py3('six') }}
BuildArch:      noarch

%description
os-apply-config is a apply configuration from cloud metadata

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup
sed -i 's#%{_bindir}/env python$#%{_bindir}/python3#g' os_apply_config/tests/templates%{_sysconfdir}/glance/script.conf

%build
%{py3_build}

%install
%{py3_install}
install -d -m 755 %{buildroot}%{_libexecdir}/os-apply-config/templates

%check
python3 -m stestr.cli run

%files
%license LICENSE
%doc README.rst
%{_bindir}/os-apply-config
%{_bindir}/os-config-applier
%{python3_sitelib}/os_apply_config
%{python3_sitelib}/*.egg-info
%dir %{_libexecdir}/os-apply-config
%dir %{_libexecdir}/os-apply-config/templates

%changelog
